package com.futureCloudMOM.core.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.futureCloudMOM.core.entity.FBaseEntity;
import com.futureCloudMOM.framework.dict.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "Basic_MaterialType", description = "物料类别表")
@TableName(value = "Basic_MaterialType")
public class BasicMaterialType extends FBaseEntity implements Serializable {



    @ApiModelProperty("")
    @TableField(value = "parentId")
    private Long parentId;

    @NotBlank(message="[物料类型编码]不能为空")
    @Size(max= 500,message="编码长度不能超过500")
    @ApiModelProperty("物料类型编码")
    @Length(max= 500,message="编码长度不能超过500")
    @TableField(value = "code")
    private String code;

    @NotBlank(message="[物料类型名称]不能为空")
    @Size(max= 500,message="编码长度不能超过500")
    @ApiModelProperty("物料类型名称")
    @Length(max= 500,message="编码长度不能超过500")
    @TableField(value = "name")
    private String name;

    @Size(max= 500,message="编码长度不能超过500")
    @ApiModelProperty("备注")
    @Length(max= 500,message="编码长度不能超过500")
    @TableField(value = "remark")
    private String remark;

    @ApiModelProperty("显示小数位数")
    @TableField(value = "decimalNumber")
    private Long decimalNumber;

    @NotNull(message="[状态]不能为空")
    @ApiModelProperty("状态")
    @TableField(value = "status")
    @Dict(dictCode = "sys_normal_disable")
    private Long status;

    @ApiModelProperty("子节点数据")
    @TableField(exist = false)
    private List<BasicMaterialType> children;



    @TableId(type = IdType.AUTO)
    @ApiModelProperty("主键ID")
    private Long id;
    @TableField(value = "sysCreateUser", fill = FieldFill.INSERT)
    @ApiModelProperty("创建用户")
//    @Dict(dictCode = "user_id",dictTable = "sys_user",dictText = "user_name")
    private Long sysCreateUser;
    @TableField(value = "sysCreateTime", fill = FieldFill.INSERT)
    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date sysCreateTime;
    @TableField(value = "sysUpdateUser", fill = FieldFill.UPDATE)
    @ApiModelProperty("更新用户")
//    @Dict(dictCode = "user_id",dictTable = "sys_user",dictText = "user_name")
    private Long sysUpdateUser;
    @TableField(value = "sysUpdateTime", fill = FieldFill.UPDATE)
    @ApiModelProperty("更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date sysUpdateTime;
    @TableField(value = "deleted")
    @ApiModelProperty("删除标志（0-正常，1-删除）")
    @TableLogic
    private Integer deleted;


}

